function BalanceDetails(params){ 
	 
}

BalanceDetails.Where = function(type,proxy){
	this.type = type;
	this.proxy=proxy;
	this.linked = null;
	this.set = null;
	if(this.type==0){
		this.set = new BalanceDetails.Where(1,true);
		this.set.linked = this;
	}
	this.getProxy = function(){
		var m = new BalanceDetails.Where(this.type);//当前的对像
		if(this.type==0){
			m.set = new BalanceDetails.Where(1,true);//set对象
			m.set.linked = m;
		}else{
			m.linked=this.linked;
			this.linked.linked=m;
		}
		return m;
	}
	this.data = {};
	this.put = function(key,value){
		this.data[key] = value;
	}
	this.get = function(key){
		return this.data[key];
	}
	/** 编号 [非空]       **/
	this.id=function(id){if(this.proxy)return this.getProxy().id(id);  this.put("id", id);return this;};
	/** and id is null */
	this.idNull=function(){if(this.proxy)return this.getProxy().idNull();if(this.get("idNot")==null)this.put("idNot", "");this.put("id", null);return this;};
	/** not .... */
	this.idNot=function(){if(this.proxy)return this.getProxy().idNot();this.put("idNot", "not");return this;};
	this.idNotNull=function(){if(this.proxy)return this.getProxy().idNotNull();this.put("idNot", "not");this.put("id", null);return this;};
	this.idNot=function(id){if(this.proxy)return this.getProxy().idNot(id);this.put("idNot", "not");this.put("id", id);return this;};
	/** and id <= ? */
	this.idMin=function(min){if(this.proxy)return this.getProxy().idMin(min);this.put("idMin", min);return this;};
	/** and id >= ? */
	this.idMax=function(max){if(this.proxy)return this.getProxy().idMax(max);this.put("idMax", max);return this;};
	this.idIn=function(ids){
		if(this.proxy)return this.getProxy().idIn(ids);  this.put("idIn", ids);return this;
	};	
	
	/** 品牌 [非空] [Merchant]      **/
	this.brand=function(brand){if(this.proxy)return this.getProxy().brand(brand);  this.put("brand", brand);return this;};
	/** and brand is null */
	this.brandNull=function(){if(this.proxy)return this.getProxy().brandNull();if(this.get("brandNot")==null)this.put("brandNot", "");this.put("brand", null);return this;};
	/** not .... */
	this.brandNot=function(){if(this.proxy)return this.getProxy().brandNot();this.put("brandNot", "not");return this;};
	this.brandNotNull=function(){if(this.proxy)return this.getProxy().brandNotNull();this.put("brandNot", "not");this.put("brand", null);return this;};
	this.brandNot=function(brand){if(this.proxy)return this.getProxy().brandNot(brand);this.put("brandNot", "not");this.put("brand", brand);return this;};
	this.brandIn=function(ids){
		if(this.proxy)return this.getProxy().brandIn(ids);  this.put("brandIn", ids);return this;
	};	
	
	/** 会员 [非空] [Member]      **/
	this.member=function(member){if(this.proxy)return this.getProxy().member(member);  this.put("member", member);return this;};
	/** and member is null */
	this.memberNull=function(){if(this.proxy)return this.getProxy().memberNull();if(this.get("memberNot")==null)this.put("memberNot", "");this.put("member", null);return this;};
	/** not .... */
	this.memberNot=function(){if(this.proxy)return this.getProxy().memberNot();this.put("memberNot", "not");return this;};
	this.memberNotNull=function(){if(this.proxy)return this.getProxy().memberNotNull();this.put("memberNot", "not");this.put("member", null);return this;};
	this.memberNot=function(member){if(this.proxy)return this.getProxy().memberNot(member);this.put("memberNot", "not");this.put("member", member);return this;};
	this.memberIn=function(ids){
		if(this.proxy)return this.getProxy().memberIn(ids);  this.put("memberIn", ids);return this;
	};	
	
	/** 所属订单 [非空] [DirectOrder]      **/
	this.order=function(order){if(this.proxy)return this.getProxy().order(order);  this.put("order", order);return this;};
	/** and order is null */
	this.orderNull=function(){if(this.proxy)return this.getProxy().orderNull();if(this.get("orderNot")==null)this.put("orderNot", "");this.put("order", null);return this;};
	/** not .... */
	this.orderNot=function(){if(this.proxy)return this.getProxy().orderNot();this.put("orderNot", "not");return this;};
	this.orderNotNull=function(){if(this.proxy)return this.getProxy().orderNotNull();this.put("orderNot", "not");this.put("order", null);return this;};
	this.orderNot=function(order){if(this.proxy)return this.getProxy().orderNot(order);this.put("orderNot", "not");this.put("order", order);return this;};
	this.orderIn=function(ids){
		if(this.proxy)return this.getProxy().orderIn(ids);  this.put("orderIn", ids);return this;
	};	
	
	/** 消费数量 [非空]       **/
	this.number=function(number){if(this.proxy)return this.getProxy().number(number);  this.put("number", number);return this;};
	/** and number is null */
	this.numberNull=function(){if(this.proxy)return this.getProxy().numberNull();if(this.get("numberNot")==null)this.put("numberNot", "");this.put("number", null);return this;};
	/** not .... */
	this.numberNot=function(){if(this.proxy)return this.getProxy().numberNot();this.put("numberNot", "not");return this;};
	this.numberNotNull=function(){if(this.proxy)return this.getProxy().numberNotNull();this.put("numberNot", "not");this.put("number", null);return this;};
	this.numberNot=function(number){if(this.proxy)return this.getProxy().numberNot(number);this.put("numberNot", "not");this.put("number", number);return this;};
	/** and number <= ? */
	this.numberMin=function(min){if(this.proxy)return this.getProxy().numberMin(min);this.put("numberMin", min);return this;};
	/** and number >= ? */
	this.numberMax=function(max){if(this.proxy)return this.getProxy().numberMax(max);this.put("numberMax", max);return this;};
	this.numberIn=function(ids){
		if(this.proxy)return this.getProxy().numberIn(ids);  this.put("numberIn", ids);return this;
	};	
	
	/** 余额产品 [非空] [Product]      **/
	this.products=function(products){if(this.proxy)return this.getProxy().products(products);  this.put("products", products);return this;};
	/** and products is null */
	this.productsNull=function(){if(this.proxy)return this.getProxy().productsNull();if(this.get("productsNot")==null)this.put("productsNot", "");this.put("products", null);return this;};
	/** not .... */
	this.productsNot=function(){if(this.proxy)return this.getProxy().productsNot();this.put("productsNot", "not");return this;};
	this.productsNotNull=function(){if(this.proxy)return this.getProxy().productsNotNull();this.put("productsNot", "not");this.put("products", null);return this;};
	this.productsNot=function(products){if(this.proxy)return this.getProxy().productsNot(products);this.put("productsNot", "not");this.put("products", products);return this;};
	this.productsIn=function(ids){
		if(this.proxy)return this.getProxy().productsIn(ids);  this.put("productsIn", ids);return this;
	};	
	
	
	
	this.add=function(key,value) {if(proxy)return proxy().add(key,value);this.put(key, value);return this;}
	this.desc=function(sql) {if(proxy)return proxy().desc(sql);this.put("desc", sql);return this;}
	this.asc=function(sql) {if(proxy)return proxy().asc(sql);this.put("asc", sql);return this;}
	this.definex=function(sql) {if(proxy)return proxy().definex(sql);this.put("definex", sql);return this;}
	
	/** 获取所有余额消费明细 **/
	this.list=function(size){
		this.data.size = size;
		var protocol = ux.ajax("/admin/products/balancedetails.list.do",this.data);
		if(!protocol)return null;
		if(protocol.data && protocol.data.list)return protocol.data.list;
		return [];
	}
	/** 获取余额消费明细分页 **/
	this.page=function(page,size){
		this.data.size = size;
		this.data.page = page;
		var protocol = ux.ajax("/admin/products/balancedetails.list.do",this.data);
		if(!protocol)return null;
		if(protocol.data)return data;
		return {list:[]};
	}
	/** 根据查询条件取余额消费明细 **/
	this.get=function(){
		this.data.size = 1;
		var protocol = ux.ajax("/admin/products/balancedetails.list.do",this.data);
		if(!protocol)return null;
		if(protocol.data && protocol.data.list && protocol.data.list.length==1)return protocol.data.list[0]; 
		return null;
	}
}

BalanceDetails.get = function(id){
	var protocol = ux.ajax("/admin/products/balancedetails.get.do",{id:id});
	if(!protocol)return null;
	if(protocol.data)return protocol.data.balanceDetails;
	return null;
}

BalanceDetails.where = new BalanceDetails.Where(0,true);